<div class="layuimini-container">
    <div class="layuimini-main">
        <fieldset id="searchFieldset_currentTable" class="table-search-fieldset layui-hide">
            <legend>{:lang("common.condition_search")}</legend>
            <form class="layui-form layui-form-pane form-search">
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("custom.name")}</label>
                    <div class="layui-input-inline">
                        <input name="c_name_like" class="layui-input" value="{$param.c_name_like|default=''}"
                               placeholder="{:lang('common.input')}{:lang('custom.name')}">
                    </div>
                </div>

                {if !auth('roleAccounting')}
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("accounting.name")}</label>
                    <div class="layui-input-inline">
                        <select name="c_accounting_id_eq" lay-search>
                            <option value="">{:lang("common.choose")}{:lang("accounting.name")}</option>
                            {foreach :getAccountingList() as $val}
                            <option value="{$val.id}">{$val.name}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>
                {/if}

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("common.status")}</label>
                    <div class="layui-input-inline">
                        <select name="c_status_eq" default-value="{$ENABLE}"
                                data-select-type="status" data-select-default="{:lang('common.choose')}">
                        </select>
                    </div>
                </div>

                <div class="layui-form-item layui-inline" style="margin-left:50px">
                    <button type="submit" class="layui-btn layui-btn-normal" data-type="tableSearch"
                            lay-submit lay-filter="search_currentTable">{:lang("common.btn_search")}
                    </button>
                </div>
            </form>
        </fieldset>

        <table id="currentTable"
               data-auth-add="{:auth(request()->controller().'/add')}"
               data-auth-edit="{:auth(request()->controller().'/edit')}"
               data-auth-delete="{:auth(request()->controller().'/delete')}"
               data-auth-print="{:auth(request()->controller().'/print')}">
        </table>
    </div>
</div>
<script>
    layui.use(['myCommon'], function () {
        var myCommon = layui.myCommon;
        myCommon.table.render({
            where: myCommon.generateCondition()
            , limit: "{$param.limit|default='15'}"
            , cols: [[
                {type: "checkbox"}
                , {field: 'id', width: 60, title: '{:lang("common.id")}', sort: true}
                , {field: 'number', width: 105, title: '{:lang("custom.number")}', sort: true}
                , {field: 'name', minWidth: 120, title: '{:lang("custom.name")}', sort: true}
                , {field: 'accounting_name', minWidth: 120, title: '{:lang("accounting.name")}', sort: true}
                , {field: 'estimate_time', width: 120, title: '{:lang("common.estimate_time_alias")}', sort: true}
                , {
                    field: 'status', width: 60, title: '{:lang("common.status")}', sort: true,
                    templet: myCommon.table.type, typeList: 'status'
                }
                , {field: 'update_time', width: 148, title: '{:lang("common.update_time")}', sort: true}
                , {
                    width: 96, title: '{:lang("common.operate")}', templet: myCommon.table.tool
                    , operat: ['edit', 'delete']
                }
            ]]
        });
        myCommon.listen();
    });
</script>
